package components.propertyCtrls
{
	import UIFree.controls.uif_checkbox;
	import UIFree.uif_component;
	
	import flash.geom.Rectangle;
	
	public class c_checkbox extends c_propertyBase {
		public static const WEIGHT: Number = 45;
		private var _chekbox: uif_checkbox;
		public function c_checkbox(parent:uif_component, aData:Object, y:Number, a_height:Number) {
			super(parent, aData, y, a_height);
		}
		
		override protected function createComponents(): void {
			super.createComponents();
			var inner: Rectangle = componentRect;
			_chekbox = new uif_checkbox(this, inner.x, inner.y, inner.width, inner.height, 'checkbox');
		}
		
		override protected function getValue():Object {
			return _chekbox.checked;
		}
		
		override protected function setData(value:Object):void {
			super.setData(value);
			_chekbox.checked = _data.value == true;
			if (_data.text) _chekbox.text = _data.text;
		}
	}
}